package org.comple.erp.utils;

import java.util.HashMap;

public class AjaxResult extends HashMap<String, Object> {

    private AjaxResult() {
    }

    public AjaxResult add(String key, Object value) {
        this.put(key, value);
        return this;
    }

    public static AjaxResult success() {
        return new AjaxResult().add("code", 5200).add("msg", "成功");
    }

    /**
     * 自定义返回结果
     * @param code
     * @param msg
     * @return
     */
    public static  AjaxResult back(String code,String msg) {
        return new AjaxResult().add("code", code).add("msg", msg);
    }

    public static AjaxResult error() {
        return new AjaxResult().add("code", 5500).add("msg", "失败");
    }

}
